part of '../repository.dart';

const _kWebBankCardTypeVisaValue = 'visa';
const _kWebBankCardTypeMastercardValue = 'mastercard';
const _kWebBankCardTypeMirValue = 'mir';
const _kWebBankCardTypeUnionPayValue = 'unionPay';
const _kWebBankCardTypeJcbValue = 'jcb';
const _kWebBankCardTypeAmericanExpressValue = 'american_express';
const _kWebBankCardTypeDinersClubValue = 'diners_club';
const _kWebBankCardTypeDiscoverCardValue = 'discover_card';
const _kWebBankCardTypeInstaPaymentValue = 'insta_payment';
const _kWebBankCardTypeInstaPaymentTMValue = 'insta_payment_tm';
const _kWebBankCardTypeLaserValue = 'laser';
const _kWebBankCardTypeDankortValue = 'dankort';
const _kWebBankCardTypeSoloValue = 'solo';
const _kWebBankCardTypeSwitchValue = 'switch';
const _kWebBankCardTypeUnknownValue = 'unknown';

class _WebBankCardTypeDto extends Equatable {
  const _WebBankCardTypeDto._internal({
    required this.bankCardTypeString,
  });

  final String bankCardTypeString;

  @override
  List<Object?> get props {
    return [
      bankCardTypeString,
    ];
  }

  factory _WebBankCardTypeDto.fromString(String bankCardTypeString) {
    return _WebBankCardTypeDto._internal(
      bankCardTypeString: bankCardTypeString,
    );
  }

  WebBankCardType toEntity() {
    return switch (bankCardTypeString) {
      _kWebBankCardTypeVisaValue => WebBankCardType.visa,
      _kWebBankCardTypeMastercardValue => WebBankCardType.mastercard,
      _kWebBankCardTypeMirValue => WebBankCardType.mir,
      _kWebBankCardTypeUnionPayValue => WebBankCardType.unionPay,
      _kWebBankCardTypeJcbValue => WebBankCardType.jcb,
      _kWebBankCardTypeAmericanExpressValue => WebBankCardType.americanExpress,
      _kWebBankCardTypeDinersClubValue => WebBankCardType.dinersClub,
      _kWebBankCardTypeDiscoverCardValue => WebBankCardType.discoverCard,
      _kWebBankCardTypeInstaPaymentValue => WebBankCardType.instaPayment,
      _kWebBankCardTypeInstaPaymentTMValue => WebBankCardType.instaPaymentTM,
      _kWebBankCardTypeLaserValue => WebBankCardType.laser,
      _kWebBankCardTypeDankortValue => WebBankCardType.dankort,
      _kWebBankCardTypeSoloValue => WebBankCardType.solo,
      _kWebBankCardTypeSwitchValue => WebBankCardType.switchCard,
      _kWebBankCardTypeUnknownValue => WebBankCardType.unknown,
      _ => throw UnimplementedError(),
    };
  }
}
